package com.qf.service.impl;

import com.qf.common.R;
import com.qf.dao.StudentDao;
import com.qf.dao.impl.StudentDaoImpl;
import com.qf.pojo.Student;
import com.qf.service.StudentService;
import com.qf.vo.BarVo;
import com.qf.vo.PieVo;

import java.util.List;

/**
 * @date 2022/4/1
 * @desc
 */
public class StudentServiceImpl implements StudentService {


    StudentDao studentDao = new StudentDaoImpl();

    @Override
    public R<List<Student>> getPageData(int page, int pageSize, Student student) {

        R<List<Student>> r = new R();
        List<Student> pageData = studentDao.getPageData(page,pageSize,student);
        long count  = studentDao.getStudentsCount(student);
        r.setCode(0);
        r.setData(pageData);
        r.setMsg("学生分页数据");
        r.setCount(count);

        return r;
    }

    @Override
    public int deleteStudentById(int id) {
        return studentDao.deleteStudentById(id);
    }

    @Override
    public int updateStudentById(Student student) {
        return studentDao.updateStudentById(student);
    }

    @Override
    public int addStudent(Student student) {
        return studentDao.addStudent(student);
    }

    @Override
    public BarVo showSexBar() {
        return studentDao.showSexBar();
    }

    @Override
    public List<PieVo> showSexPie() {
        return studentDao.showSexPie();
    }
}
